<div class="data-div" xmlns:th="http://www.w3.org/1999/xhtml">
    <div class="widget-header bordered-bottom bordered-themeprimary">
        <i class="widget-icon fa fa-tasks themeprimary"></i>
        <span class="widget-caption themeprimary">数据列表</span>
        <form  role="form" onsubmit="return false;" id="form_data_table_user_list_1">
            <div class="widget-buttons">
                用户ID：<input type="text" name="uid" style="width:120px;height:25px;margin-right:10px;padding: 3px;">
                用户名（电话）：<input type="text" name="userName" style="width:120px;height:25px;margin-right:10px;padding: 3px;">
                用户昵称：<input type="text" name="nickName" style="width:120px;height:25px;margin-right:10px;padding: 3px;">
                vip等级:<select name="vipType" id="vipType"  style="width:160px;margin-right:10px;padding: 3px;" >
                <option value="">--全部--</option>
                <option value="0">--非vip--</option>
                <option th:each="vip:${vipInfos}"  th:value="${vip.id}" th:text="'--'+${vip.vipName}+'--'"></option>
                </select>
                官方授权码：<input type="text" name="officialNumber" style="width:120px;height:25px;margin-right:10px;padding: 3px;">
            </div>
            <div class="widget-buttons">
                <button href="javascript:;" class="btn btn-blue btn-xs search"  data-title="查询" data-form="true" onclick="">查询</button>
            </div>

            <div class="widget-buttons buttons-bordered">
               <button href="user/add_page" class="btn btn-palegreen btn-xs" data-handler="MODAL" modal-size="800px" data-title="添加用户">添加用户</button>
            </div>

        </form>
    </div>

    <div class="widget no-header ">
        <div class="widget-body">
            <table class="table table-condensed table-bordered table-hover " id="data_table_user_list_1">
            </table>

        </div>
    </div>
    <!-- END SAMPLE TABLE PORTLET-->
</div>

<script type="text/javascript">

    $(document).ready(function() {

        //look-up 查询条件 会员
        Select2Ex.handleForm4select2({target:$("#form_data_table_user_list_1")});

        TableAjax.init('data_table_user_list_1',{
            sAjaxSource: "user/list",
            aaSorting: [
                [0, "asc" ]
            ], // 需要自定义
            uxDataTitle:"null",
            uxCheckable:false,
            uxCloseScroll:true,
            uxDrapable:false,
            aoColumns: [
                {sTitle:'用户ID',  mData: "id",uxLongText:true},
                {sTitle:'用户名',  mData: "userName"},
                {sTitle:'昵称',  mData: "nickName"},
                {sTitle:'合伙人等级',  mData: "vipType",
                    mRender:function(data,d,all){
                        var jiaose = "";
                        if(all.vipType==1){jiaose="<font color='green'>运营商</font>";}
                        if(all.vipType==2){jiaose="<font color='green'>渠道商</font>";}
                        if(all.vipType==3){jiaose="<font color='green'>推广员</font>";}
                        if(all.vipType==0){jiaose="粉丝";}
                        if(all.vipType==21){jiaose="<font color='#8a2be2'>省级服务商</font>";}
                        if(all.vipType==23){jiaose="<font color='#8a2be2'>区县服务商</font>";}
                        return jiaose;
                    }
                },
                {sTitle:'官方授权码',  mData: "officialServiceNumber",mRender:function (data,d,all) {
                    if(all.vipType>0){
                        return all.officialServiceNumberView;
                    }else{
                        return "-";
                    }

                }},
                {sTitle:'推广码',  mData: "pushCode"},
                {sTitle:'佣金',  mData: "commission",mRender:function (data,d,all) {
                        return (all.commission/100).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
                    }},
                {sTitle:'可提现',  mData: "commissionDeposit",mRender:function (data,d,all) {
                        return (all.commissionDeposit/100).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
                    }},
                {sTitle:'已提现',  mData: "commissionPaid",mRender:function (data,d,all) {
                        return (all.commissionPaid/100).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
                    }},
                {sTitle:'提现中',  mData: "commissionPaying",mRender:function (data,d,all) {
                        return (all.commissionPaying/100).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
                    }},
                // {sTitle:'注册时间',  mData: "regTime",
                //     mRender:function(data,d,all){
                //         return all.regTimeStr;
                //     }
                // },
                {sTitle:'禁用状态',  mData: "isDel",
                    mRender:function(data,d,all){
                        var disable = "";
                        if (all.isDel==0){
                            disable = "<font color='green'>未禁用</font>";
                        }else if (all.isDel==1){
                            disable = "<font color='red'>已禁用</font>";
                        }
                        return disable;
                    }
                },
                {sTitle:'到账状态',  mData: "toTheAccount",
                    mRender:function(data,d,all){
                        var disable = "";
                        if (all.toTheAccount==0){
                            disable = "<font color='red'>未到账</font>";
                        }else if (all.toTheAccount==1){
                            disable = "<font color='green'>已到账</font>";
                        }
                        return disable;
                    }
                },
                {sTitle:'测试用户',  mData: "isTest",
                    mRender:function(data,d,all){
                        var isTest = "";
                        if (all.isTest==0){
                            isTest = "<font color='green'>否</font>";
                        }else if (all.isTest==1){
                            isTest = "<font color='red'>是</font>";
                        }
                        return isTest;
                    }
                },
                {sTitle:'来源',  mData: "source",
                    mRender:function(data,d,all){
                        var source = "";
                        if (all.source==0||all.source==null){
                            source = "<font color='green'>线上</font>";
                        }else if (all.source==1){
                            source = "<font color='green'>线下</font>";
                        }
                        return source;
                    }
                },

                {sTitle:'操作',
                    mData: "id" ,
                    mRender:function(data,d,all){
                        var html = "";
                        html += '<a class="blue-stripes" style="margin:15px" data-title="VIP升级" data-handler="MODAL" href="user/vip_mod_page?id='+all.id+'" modal-size="820px">VIP升级</a>'
                            +'|'
                            +'<a class="blue-stripes" style="margin:15px" data-title="基本信息修改" data-handler="MODAL" href="user/info_mod_page?id='+all.id+'" modal-size="820px">修改</a>'
                            +'|'
                            +'<a style="margin:15px" data-handler="CONFIRM"  href="user/disabled?id='+all.id+'">禁用</a>'
                            +'|'
                            +'<a class="blue-stripes" style="margin:15px" data-title="直推合伙人" data-handler="MODAL" href="user/second_list_page?id='+all.id+'" modal-size="90%">下级合伙人</a>'
                            +'|'
                            +'<a class="blue-stripes" style="margin:15px" data-title="推广人信息" data-handler="MODAL" href="user/pusher_page?id='+all.id+'" modal-size="820px">推广人</a>';
                        /*if (all.toTheAccount==0&&(all.vipType==1||all.vipType==2||all.vipType==3)){
                            html += '|'+'<a style="margin:15px" data-handler="CONFIRM"  href="user/accountable?id='+all.id+'">确认到账</a>'
                        }*/
                        if (all.isAdmin!=1&&all.vipType!=0){
                            html += '|<a class="blue-stripes" style="margin:15px" data-title="确认到账" data-handler="MODAL" href="user/money_ok_page?id='+all.id+'" modal-size="820px">确认到账</a>';
                            //html += '|<a style="margin:15px" data-handler="CONFIRM"  href="user/accountable?id='+all.id+'">确认到账</a>'
                            html += '|<a class="blue-stripes" style="margin:15px" data-title="商户添加" data-handler="MODAL" href="merchant/add_page?uid='+all.id+'" modal-size="90%">添加商户</a>';
                        }
                        html += '|'+'<a class="blue-stripes" style="margin:15px" data-title="佣金详情" data-handler="INLINE" href="commission_log/cur_user_list_page?uid='+all.id+'" modal-size="99%">佣金详情</a>';
                        html += '|'+'<a class="blue-stripes" style="margin:15px" data-title="提现记录" data-handler="INLINE" href="commission_get_log/cur_user_list_page?uid='+all.id+'" modal-size="99%">提现记录</a>';
                        html += '|'+'<a class="blue-stripes" style="margin:15px" data-title="修改推广人" data-handler="MODAL" href="user/pusher_replace_page?uid='+all.id+'" modal-size="800px">修改推广人</a>';
                        return html;
                    }
                }
            ]

        });

    });

</script>